//****************************************************
// Porman Project 2
// Filename: WinMain.h
// Date: 2009/08/15
// Author: KengYu Lin
// Modify:
//****************************************************
#ifndef _WINMAIN_H
#define _WINMAIN_H
#include "../common/boost_1_42/boost/thread.hpp"
#include "../common/CWinClass.h"
#include "../common/CHRTimer.h"
#include "CRenderSystem.h"

int WINAPI WinMain(	HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);

class CMyWinClass : public CWinClass
{
public:
    CMyWinClass( void );
    virtual ~CMyWinClass( void );

    int run( void );
    void drawing( void );

    bool initialGL( void );
    void resizeGL( int iWidth, int iHeight );
    void updateGL( void );
    void swapGL( void );
    void drawGL( void );
    void killGL( void );

protected:
    LRESULT CALLBACK _processWndProce( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

protected:
    Porman::RS::CRenderCamera* m_pCamera;
    Porman::RS::CRenderWindow* m_pRWindow;
    CHRTimer* m_pTimer;

    bool m_bFinish;
    bool m_bReadyForDrawing;
    bool m_bMultiThreadRendering;
    bool m_bReflash;
    boost::mutex m_Mutex;
    boost::thread* m_pThread;
    boost::condition_variable m_cond;
};

#endif
